﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lamex.SIESystemManager.Calculate
{
    public class C_D30
    {

        public double[] GetD30(DataRow[] dr1, DataRow[] dr2, double MachineValue)
        {
            //TD30 = 0;
            double[] TD30 = { 0, 0 };
            double TBGD = 0;//固定时间
            double TD30_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double TD30_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double TD30_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double TD30_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double TD30_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double TD30_Horizontal_drilling = 0;//D11_钻水平上孔
            double TD30_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double TD30_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double TD30_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double TD30_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double TD30_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double TD30_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double TD30_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double TD30_Number_of_special_gongs = 0;//D11_异形锣数量
            double TD30_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double TD30_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double TD30_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double TD30_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double TD30_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double TD30_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double TD30_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度

            double WD30_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double WD30_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double WD30_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double WD30_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double WD30_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double WD30_Horizontal_drilling = 0;//D11_钻水平上孔
            double WD30_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double WD30_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double WD30_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double WD30_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double WD30_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double WD30_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double WD30_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double WD30_Number_of_special_gongs = 0;//D11_异形锣数量
            double WD30_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double WD30_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double WD30_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double WD30_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double WD30_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double WD30_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double WD30_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度

            double AD30_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double AD30_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double AD30_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double AD30_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double AD30_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double AD30_Horizontal_drilling = 0;//D11_钻水平上孔
            double AD30_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double AD30_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double AD30_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double AD30_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double AD30_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double AD30_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double AD30_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double AD30_Number_of_special_gongs = 0;//D11_异形锣数量
            double AD30_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double AD30_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double AD30_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double AD30_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double AD30_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double AD30_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double AD30_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度

            //获取数据库每个工序动作的单位工时和附加工时
            foreach (var drHours in dr2)
            {
                switch (drHours["OPERATIONAL_NAME"].ToString())
                {
                    case "S钻垂直盲孔":
                        WD30_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻垂直通孔":
                        WD30_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻垂直套孔":
                        WD30_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻水平前孔":
                        WD30_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻水平后孔":
                        WD30_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻水平上孔":
                        WD30_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S钻水平下孔":
                        WD30_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣45盲孔":
                        WD30_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣45通孔":
                        WD30_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣70盲孔":
                        WD30_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣70通孔":
                        WD30_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣71盲孔":
                        WD30_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S圆锣71通孔":
                        WD30_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S异形锣数量":
                        WD30_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "异形锣长度":
                        WD30_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S异形锣宽度":
                        WD30_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S锣锁档片孔":
                        WD30_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S锣拉手孔":
                        WD30_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S锯片槽数量":
                        WD30_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S锯片槽长度":
                        WD30_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "S锯片槽宽度":
                        WD30_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD30_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                }
            }
            foreach (var drData in dr1)
            {
                TD30_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_vertical_blind_hole"].ToString()) ? "0" : drData["D30_Drilling_vertical_blind_hole"].ToString());//D30_钻垂直盲孔
                TD30_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_vertical_through_hole"].ToString()) ? "0" : drData["D30_Drilling_vertical_through_hole"].ToString());//D30_钻垂直通孔
                TD30_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_Vertical_Sleeve_Hole"].ToString()) ? "0" : drData["D30_Drilling_Vertical_Sleeve_Hole"].ToString());//D30_钻垂直套孔
                TD30_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_horizontal_front_hole"].ToString()) ? "0" : drData["D30_Drilling_horizontal_front_hole"].ToString());//D30_钻水平前孔
                TD30_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_Horizontal_Rear_Hole"].ToString()) ? "0" : drData["D30_Drilling_Horizontal_Rear_Hole"].ToString());//D30_钻水平后孔        
                TD30_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drData["D30_Horizontal_drilling"].ToString()) ? "0" : drData["D30_Horizontal_drilling"].ToString());//D30_钻水平上孔
                TD30_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drData["D30_Drilling_Horizontal_Downhole"].ToString()) ? "0" : drData["D30_Drilling_Horizontal_Downhole"].ToString());//D30_钻水平下孔
                TD30_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_45_blind_hole"].ToString()) ? "0" : drData["D30_Round_Gong_45_blind_hole"].ToString());//D30_圆锣45盲孔
                TD30_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_45_through_hole"].ToString()) ? "0" : drData["D30_Round_Gong_45_through_hole"].ToString());//圆锣45通孔
                TD30_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_70_blind_hole"].ToString()) ? "0" : drData["D30_Round_Gong_70_blind_hole"].ToString());//D30_圆锣70盲孔
                TD30_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_70_through_hole"].ToString()) ? "0" : drData["D30_Round_Gong_70_through_hole"].ToString());//D30_圆锣70通孔
                TD30_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_71_blind_hole"].ToString()) ? "0" : drData["D30_Round_Gong_71_blind_hole"].ToString());//D30_圆锣71盲孔
                TD30_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Round_Gong_71_through_hole"].ToString()) ? "0" : drData["D30_Round_Gong_71_through_hole"].ToString());//D30_圆锣71通孔
                TD30_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drData["D30_Number_of_special_gongs"].ToString()) ? "0" : drData["D30_Number_of_special_gongs"].ToString());//D30_异形锣数量
                TD30_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drData["D30_Length_of_Special_shaped_Gong"].ToString()) ? "0" : drData["D30_Length_of_Special_shaped_Gong"].ToString());//D30_异形锣长度
                TD30_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drData["D30_Width_of_Special_shaped_Gong"].ToString()) ? "0" : drData["D30_Width_of_Special_shaped_Gong"].ToString());//D30_异形锣宽度
                TD30_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Gong_lock_block_hole"].ToString()) ? "0" : drData["D30_Gong_lock_block_hole"].ToString());//D30_锣锁档片孔
                TD30_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drData["D30_Gong_handle_hole"].ToString()) ? "0" : drData["D30_Gong_handle_hole"].ToString());//D30_锣拉手孔孔
                TD30_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drData["D30_Number_of_sawblade_grooves"].ToString()) ? "0" : drData["D30_Number_of_sawblade_grooves"].ToString());//D30_锯片槽数量
                TD30_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drData["D30_Saw_blade_groove_length"].ToString()) ? "0" : drData["D30_Saw_blade_groove_length"].ToString());//D30_锯片槽长度
                TD30_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drData["D30_Width_of_saw_blade_groove"].ToString()) ? "0" : drData["D30_Width_of_saw_blade_groove"].ToString());//D30_锯片槽宽度
            }
            //所有时间
            if (TD30_Drilling_vertical_blind_hole != 0 || TD30_Drilling_vertical_through_hole != 0 || TD30_Drilling_Vertical_Sleeve_Hole != 0 ||
                TD30_Drilling_horizontal_front_hole != 0 || TD30_Drilling_Horizontal_Rear_Hole != 0 || TD30_Horizontal_drilling != 0 ||
                TD30_Drilling_Horizontal_Downhole != 0 || TD30_Round_Gong_45_blind_hole != 0 || TD30_Round_Gong_45_through_hole != 0 ||
                TD30_Round_Gong_70_blind_hole != 0 || TD30_Round_Gong_70_through_hole != 0 || TD30_Round_Gong_71_blind_hole != 0 ||
                TD30_Round_Gong_71_through_hole != 0 || TD30_Number_of_special_gongs != 0 || TD30_Length_of_Special_shaped_Gong != 0 ||
                TD30_Width_of_Special_shaped_Gong != 0 || TD30_Gong_lock_block_hole != 0 || TD30_Gong_handle_hole != 0 ||
                TD30_Number_of_sawblade_grooves != 0 || TD30_Saw_blade_groove_length != 0 || TD30_Width_of_saw_blade_groove != 0)
            {
                TBGD = 10;
            }


            if (MachineValue != 0)
            {
                #region 机器工时
                TD30[0] = MachineValue + TBGD;
                TD30[1] = 1;
                #endregion
            }

            else
            {
                #region 逻辑工时
                if (TD30_Drilling_vertical_blind_hole != 0)
                {
                    TD30[0] = WD30_Drilling_vertical_blind_hole * TD30_Drilling_vertical_blind_hole + AD30_Drilling_vertical_blind_hole;
                }
                if (TD30_Drilling_vertical_through_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Drilling_vertical_through_hole * TD30_Drilling_vertical_through_hole + AD30_Drilling_vertical_through_hole;
                }
                if (TD30_Drilling_Vertical_Sleeve_Hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Drilling_Vertical_Sleeve_Hole * TD30_Drilling_Vertical_Sleeve_Hole + AD30_Drilling_Vertical_Sleeve_Hole;
                }
                if (TD30_Drilling_horizontal_front_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Drilling_horizontal_front_hole * TD30_Drilling_horizontal_front_hole + AD30_Drilling_horizontal_front_hole;
                }
                if (TD30_Drilling_Horizontal_Rear_Hole != 0)
                {
                    TD30[0] = TD30[0] + ((WD30_Drilling_Horizontal_Rear_Hole * TD30_Drilling_Horizontal_Rear_Hole) + AD30_Drilling_Horizontal_Rear_Hole);
                }
                if (TD30_Horizontal_drilling != 0)
                {
                    TD30[0] = TD30[0] + WD30_Horizontal_drilling * TD30_Horizontal_drilling + AD30_Horizontal_drilling;
                }
                if (TD30_Drilling_Horizontal_Downhole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Drilling_Horizontal_Downhole * TD30_Drilling_Horizontal_Downhole + AD30_Drilling_Horizontal_Downhole;
                }
                if (TD30_Round_Gong_45_blind_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_45_blind_hole * TD30_Round_Gong_45_blind_hole + AD30_Round_Gong_45_blind_hole;
                }
                if (TD30_Round_Gong_45_through_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_45_through_hole * TD30_Round_Gong_45_through_hole + AD30_Round_Gong_45_through_hole;
                }
                if (TD30_Round_Gong_70_blind_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_70_blind_hole * TD30_Round_Gong_70_blind_hole + AD30_Round_Gong_70_blind_hole;
                }
                if (TD30_Round_Gong_70_through_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_70_through_hole * TD30_Round_Gong_70_through_hole + AD30_Round_Gong_70_through_hole;
                }
                if (TD30_Round_Gong_71_blind_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_71_blind_hole * TD30_Round_Gong_71_blind_hole + AD30_Round_Gong_71_blind_hole;
                }
                if (TD30_Round_Gong_71_through_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Round_Gong_71_through_hole * TD30_Round_Gong_71_through_hole + AD30_Round_Gong_71_through_hole;
                }
                if (TD30_Number_of_special_gongs != 0 || TD30_Length_of_Special_shaped_Gong != 0 || TD30_Width_of_Special_shaped_Gong != 0)
                {
                    TD30[0] = TD30[0] + TD30_Number_of_special_gongs *
                           ((TD30_Length_of_Special_shaped_Gong * TD30_Width_of_Special_shaped_Gong * 0.0024456) + 6);
                }
                if (TD30_Gong_lock_block_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Gong_lock_block_hole * TD30_Gong_lock_block_hole + AD30_Gong_lock_block_hole;
                }
                if (TD30_Gong_handle_hole != 0)
                {
                    TD30[0] = TD30[0] + WD30_Gong_handle_hole * TD30_Gong_handle_hole + AD30_Gong_handle_hole;
                }
                if (TD30_Number_of_sawblade_grooves != 0 || TD30_Saw_blade_groove_length != 0 || TD30_Width_of_saw_blade_groove != 0)
                {
                    TD30[0] = TD30[0] + TD30_Number_of_sawblade_grooves *
                        ((TD30_Saw_blade_groove_length * 0.00573 * (Math.Ceiling(TD30_Width_of_saw_blade_groove / 7))) +
                        (3 * Math.Ceiling(TD30_Width_of_saw_blade_groove / 7)));
                }
                //总工时
                if (TD30[0] == 0)
                {
                    TD30[0] = 0;
                }
                else
                {
                    TD30[0] = TD30[0] + TBGD;
                }
                TD30[1] = 0;
                #endregion
            }

            return TD30;
        }
    }
}